home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1996 / MacHack 1996.toast / Hacks / Hacks ’89 / Gas Gauge / Windows / windows_Init.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-06-16  |  2.2 KB  |  70 lines  |  [TEXT/KAHL]

  1. /*             Copyright (c) 1988 by Caldera Corporation                        */
  2.     
  3. /*            PO box 3252, Ann Arbor, MI 48106   (313) 996-9059                */
  4.  
  5. /*        File:         windows_init.c
  6.         Compilers:     LightSpeedC 3.0, Aztec C 3.0                            */
  7.  
  8. /*        Abstract:                                                            */
  9. /*            high level and code segment 1 routines for windows                */
  10.  
  11. /*        History:                                                            */
  12. /*            2/10/89 1.0d - released final 1.0 version                         */
  13.  
  14.  
  15. #include    <Compatability.h>            /* handle compiler differences        */
  16. #include    <StdInclude.h>                /* include required headers, etc    */
  17. #include    "windows.h"                    /* include globals, prototypes, etc    */
  18.  
  19. void Set_up_menus()
  20. {
  21.     int            i;
  22.     MenuHandle    subHdl;
  23.  
  24.     InitMenus();                                  /* initialize Menu Manager    */
  25.     for (i = 1; i <= MAXMENUS; i++) 
  26.     {
  27.         menuHdls[i] = GetMenu(RESID_BASE + i);
  28.         if (menuHdls[i] != NULL)
  29.             InsertMenu(menuHdls[i], 0);
  30.     }
  31.     DrawMenuBar();
  32.     if (menuHdls[1] != NULL)
  33.         AddResMenu(menuHdls[1], 'DRVR');        /* add Desk Acc. from System*/
  34.  
  35.     subHdl = GetMenu(65);                        /* get submenu template        */
  36.     if (subHdl != NULL)    
  37.         InsertMenu(subHdl, -1);            /* add but don't display in menubar    */
  38. }
  39.  
  40.  
  41. void Init_all()
  42. {
  43.     int        i;
  44.  
  45.     InitGraf(&thePort);              /* init Quickdraw and global variables        */
  46.     InitFonts();                   /* initialize Font manager                    */
  47.     InitWindows();                   /* init Window manager, setup WMgr GrafPort    */
  48.     Set_up_menus();                  /* routine to set up menubar                 */
  49.     TEInit();                      /* inititalize TextEdit                        */
  50.     InitDialogs(NULL);            /* initialize Dialog manager                */
  51.     
  52.     dragRect = screenBits.bounds;        /* set drag rect to size of screen    */
  53.     dragRect.top = dragRect.top - 20;    /* adjust top for menu bar heigth    */
  54.     InsetRect(&dragRect,6,6);            /* walk in from edges on four sides    */
  55.     
  56.     done = FALSE;                  /* initialize Main Event Loop done flag        */
  57.  
  58.     for (i=0; i<MAXWINDOWS; i++)        /* initialize wPtrs array to unused    */
  59.         wPtrs[i] = NULL;
  60.  
  61.     limitRect = screenBits.bounds;        /* set max rect to size of screen    */
  62.     limitRect.top = 50;                    /* set min rect to 50 pixels tall    */
  63.     limitRect.left = 50;                /* set min rect to 50 pixels wide    */
  64.  
  65.     FlushEvents(everyEvent, 0);    /* clear the Event queue of all events         */
  66.  
  67.     InitCursor();                  /* set the cursor to arrow instead of clock    */
  68.     AllocWindow();                /* just for MacHack to bring up window/CDEF    */
  69. }
  70.